import { merge } from 'lodash-es'

/**
 * @ProjectName： naive-admin
 * @FileName： global-config.ts
 * @Description: // 全局错误提示配置组合式API
 * @Author: ellwood
 * @date: 2024/1/16 - 8:50
 * @Version: V1.0.0
 */
interface GlobalConfigType {
  notification?: ReturnType<typeof useNotification>
  message?: ReturnType<typeof useMessage>
  dialog?: ReturnType<typeof useDialog>
  loadingBar?: ReturnType<typeof useLoadingBar>
}

const globalConfig: GlobalConfigType = {}

export function useGlobalConfig(): GlobalConfigType {
  return globalConfig
}

export function useGlobalConfigProvider(config: GlobalConfigType) {
  merge(globalConfig, config)
}
